package com.thuanpq60023.easyenglish.bus;

import android.content.Context;

import com.thuanpq60023.easyenglish.adapter.UnitAdapter;
import com.thuanpq60023.easyenglish.entity.UnitEntity;

public class UnitBus {
	private UnitAdapter mDbAdapter;

	public UnitBus(Context context) {
		mDbAdapter = new UnitAdapter(context);
	}

	public boolean checkUnit(String name) {
		return mDbAdapter.getUnitByName(name) != null;
	}

	public boolean insertUnit(UnitEntity entity) {
		// boolean flag = true;
		return mDbAdapter.insertUnit(entity);
	}

	public boolean deleteUnitByName(String name) {
		return mDbAdapter.deleteUnitByName(name);
	}

	public void updateUnitByName(UnitEntity entity) {
		mDbAdapter.updateUnitByName(entity);
	}

	public UnitEntity getUnitByName(String name) {
		return mDbAdapter.getUnitByName(name);
	}
	
	public String[] getAllUnitName() {
		return mDbAdapter.getAllUnitName();
	}

	public UnitEntity[] getAllUnit() {
		return mDbAdapter.getAllUnit();
	}
}
